Problem Note 30862: PROC MEANS output is streamed across a single row when displayed in Microsoft Excel
When HTML, CSV, or XLS output is created by PROC MEANS or PROC SUMMARY with the PRINT option, the table that is displayed in Microsoft Excel will contain only one row. PROC MEANS/SUMMARY creates a stacked table, which cannot be displayed correctly by Microsoft Excel.
To circumvent the problem for the HTML and CSV destinations, create an output data set using the OUTPUT statement, transpose the output data set using PROC TRANSPOSE, and use PROC PRINT or PROC REPORT to display the transposed output. The sample code on the Full Code tab illustrates this.
Operating System and Release Information
SAS System | Base SAS | z/OS | 8.2 TS2M0 | 9.4 TS1M0 |
OpenVMS VAX | 8.2 TS2M0 | 9.4 TS1M0 |
OS/2 | 8.2 TS2M0 | |
Microsoft Windows 95/98 | 8.2 TS2M0 | |
Microsoft Windows 2000 Advanced Server | 8.2 TS2M0 | |
Microsoft Windows 2000 Datacenter Server | 8.2 TS2M0 | |
Microsoft Windows 2000 Server | 8.2 TS2M0 | |
Microsoft Windows 2000 Professional | 8.2 TS2M0 | |
Microsoft Windows NT Workstation | 8.2 TS2M0 | |
Microsoft Windows Server 2003 Datacenter Edition | 8.2 TS2M0 | 9.4 TS1M0 |
Microsoft Windows Server 2003 Enterprise Edition | 8.2 TS2M0 | 9.4 TS1M0 |
Microsoft Windows Server 2003 Standard Edition | 8.2 TS2M0 | 9.4 TS1M0 |
Microsoft Windows XP Professional | 8.2 TS2M0 | 9.4 TS1M0 |
Windows Millennium Edition (Me) | 8.2 TS2M0 | |
64-bit Enabled AIX | 8.2 TS2M0 | 9.4 TS1M0 |
64-bit Enabled HP-UX | 8.2 TS2M0 | 9.4 TS1M0 |
64-bit Enabled Solaris | 8.2 TS2M0 | 9.4 TS1M0 |
ABI+ for Intel Architecture | 8.2 TS2M0 | 9.4 TS1M0 |
AIX | 8.2 TS2M0 | 9.4 TS1M0 |
HP-UX | 8.2 TS2M0 | 9.4 TS1M0 |
IRIX | 8.2 TS2M0 | 9.4 TS1M0 |
Linux | 8.2 TS2M0 | 9.4 TS1M0 |
OpenVMS Alpha | 8.2 TS2M0 | 9.4 TS1M0 |
Solaris | 8.2 TS2M0 | 9.4 TS1M0 |
Tru64 UNIX | 8.2 TS2M0 | 9.4 TS1M0 |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
This code generates a CSV and XLS file with output that mimics the default PROC MEANS/SUMMARY table in the LISTING destination.
/* Open the CSV, EXCELXP, and LISTING destinations */
ods csv file="csv.csv";
ods tagsets.excelxp file="excelxp.xls";
ods listing;
/* Add the NOPRINT option to prevent the default table from displaying */
proc means data=sashelp.class noprint;
var age height;
/* Create an output data set without the variables _TYPE_ and _FREQ_ */
output out=new(drop=_type_ _freq_);
run;
/* Transpose the output data set using the _STAT_ variable to name */
/* the columns */
proc transpose data=new out=out;
id _stat_;
run;
/* Print the data set with labels that match the output from the */
/* default MEANS/SUMMARY table */
proc print data=out l noobs;
var _name_ n mean std min max ;
label mean="Mean"
std="Std Dev"
min="Minimum"
max="Maximum"
_name_="Variable";
run;
/* Close all of the open destinations */
ods _all_ close;
/* Reopen the LISTING destination */
ods listing;
Type: | Problem Note |
Priority: | medium |
Date Modified: | 2008-01-04 15:34:04 |
Date Created: | 2008-01-04 10:01:49 |